<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 2, 1, 4, 5, 6, 4]
        function unique(arr) {
            return Array.from(new Set(arr))
        }
        console.log(unique(arr))
        p = new Set(arr)
        p2 = new Set([...arr])
        p3 = Array.from(new Set(arr))
        console.log(p);
        console.log(p2);
        console.log(p3);
    </script>
</body>

</html>